Esempio n. 1
0
 protected virtual void Awake()
 {
     m_MovementModel    = GetComponent <ICharacterMovementModel>();
     m_MovementView     = GetComponent <ICharacterMovementView>();
     m_InteractionModel = GetComponent <ICharacterInteractionModel>();
     m_TailView         = GetComponent <ICharacterTailView>();
 }
        public CharacterMovementController(ICharacterMovementModel characterMovementModel,
                                           ICharacterMovementView characterMovementView)
        {
            _characterMovementModel = characterMovementModel;
            _characterMovementView  = characterMovementView;

            characterMovementView.OnMovementInitialize += HandleInitializeParams;
            characterMovementView.OnDestinationReached += HandleDestinationReached;

            characterMovementModel.OnDestinationChanged    += HandleDestinationChanged;
            characterMovementModel.OnFindPathToDestination += HandleFindPath;
            characterMovementModel.OnVelocityChanged       += HandleVelocityChanged;
            SyncDestinations();
        }
Esempio n. 3
0
 // Character construction
 public CharacterModel(GameObject character, Sprite characterHudImage, ICharacterStatModel characterStatModel, ICharacterMovementModel characterMovementModel)
 {
     // Character game object
     Character = character;
     // Character Hud Image
     HudImageSprite = characterHudImage;
     // Character stats
     CharacterStatModel           = characterStatModel;
     characterStatModel.Character = character;
     // Character movements
     CharacterMovementModel = characterMovementModel;
     // Assign id to this character
     Id = CharactersData.CharacterModels.Count;
     // Add character to characters
     CharactersData.CharacterModels.Add(this);
 }
Esempio n. 4
0
 /// <summary>
 /// Enables interaction with shapes.
 /// </summary>
 /// <param name="movementModel"></param>
 public void EnableInteraction(ICharacterMovementModel movementModel)
 {
     this.m_MovementModel = movementModel;
     m_InteractionEnabled = true;
 }
Esempio n. 5
0
 // Create the model
 public CharacterMovementModelFactory(Vector3 position, Vector3 rotation, float moveSpeed)
 {
     Model = new CharacterMovementModel(position, rotation, moveSpeed);
 }