Unity and Flutter apps Home Page
Work to create apps for generating revenue
Loading...
Searching...
No Matches
Collision Namespace Reference

Classes

class  AttractCollisionAction
 Details the action to be taken when a collision occurs with the target. In this class the target is attracted to the collider. The strength of the attraction can be specified. More...
class  BounceCollisionAction
 Details the action to be taken when a collision occurs with the target. In this class the target is bounced away from the collider. The strength of the bounce can be specified. More...
class  CollisionActionController
 The collision action controller is responsible for handling the collision of a GameObject. It uses an interface implemented by a number of different action classes with dofferent effects when the target enters or leaves the collision effect zone. More...
class  CollisionActionFactory
class  DeathCollisionAction
 Details the action to be taken when a collision occurs with the target. In this class the target is killed when it hits the collider The strength of the death is not relevant in this case. More...
interface  ICollisionAction
 This interface is used to allow for different collision effects to be chosen for the collition action controller. More...
class  SpeedChangeCollisionAction
 Details the action to be taken when a collision occurs with the target. In this class the target is sped up by the collider. The strength of the effect can be specified. More...

Enumerations

enum  CollisionActionEnum { Bounce = 0 , SpeedChange = 1 , Death = 2 , Attract = 3 }
enum  CollisionEffectStrengthEnum {
  Full = 15 , Strong = 10 , MedStrong = 7 , Normal = 5 ,
  Half = 3 , Low = 2 , Lowest = 1
}

Detailed Description

How collisions work

The collision scripts are added to an object.

It may have a collision radius as which point an effect will start to be applied. All collision actions must implement the ICollisionAction interface.

The CollisionActionController controls the Action(CollisionActionEnum) and in unity the user will set the collision Action(CollisionActionEnum) and strength(CollisionEffectStrengthEnum) It is the CollisionActionController that is added to the object to control the effect.

The object is expected to have a Mesh Collider of the appropriate shape to start the effect For some actions this will be on hitting the object and for some it will be based on proximity to the target object

The color of the object is determined by the action and the strength of the effect.

There is a method in the CollisionActionController called onDrawGizmos() that sets the color in edit mode. This method defers to setColorBasedOnCollisionTypeAndStrenth() and is also called in game mode to set the same color.

Adding a new action then needs to implement the ICollisionAction interface

Adding a new object using the action needs to add the CollisionActionController and add an appropriate triggering mesh for when the effect is in play. TODO: Add a class diagram and an interaction diagram. Interaction diagram should have colors for unity objects and 'scripts' C#

Enumeration Type Documentation

◆ CollisionActionEnum

Enumerator
Bounce 
SpeedChange 
Death 
Attract 

◆ CollisionEffectStrengthEnum

Enumerator
Full 
Strong 
MedStrong 
Normal 
Half 
Low 
Lowest