Inheritance: MonoBehaviour
コード例 #1
0
ファイル: Character.cs プロジェクト: DungeonMaggot/Dungeon2
    public override void TakeDamage(int damage, Vector2Int damageDir, Vector2Int attackTilePos)
    {
        if (IsAlive())
        {
            // "take damage" sound
            float randomValue = Random.value;
            if (randomValue >= 0.0f && randomValue < 0.33f)
            {
                m_AudioSource.PlayOneShot(m_TakeDamage1);
            }
            else if (randomValue >= 0.33f && randomValue < 0.66f)
            {
                m_AudioSource.PlayOneShot(m_TakeDamage2);
            }
            else
            {
                m_AudioSource.PlayOneShot(m_TakeDamage3);
            }

            m_hitpoints        -= damage;
            m_incomingDamageDir = damageDir;
            if (m_hitpoints <= 0)
            {
                m_hitpoints     = 0;
                m_currentAction = EntityActions.Die;
                m_actionTimer   = m_dieSeconds;
                Die();
            }
        }
    }
コード例 #2
0
ファイル: ProjectForm.cs プロジェクト: yzwbrian/GwinApp
        /// <summary>
        /// Show the Entitu in EntyForm
        /// </summary>
        /// <param name="CriteriaFilter"></param>
        /// <param name="EntityAction"></param>
        public override void ShowEntity(Dictionary <string, object> CriteriaFilter, EntityActions EntityAction)
        {
            Project project = this.Entity as Project;

            txtText.Text        = project.Title.Current;
            txtDescription.Text = project.Description.Current;
        }
コード例 #3
0
ファイル: Character.cs プロジェクト: DungeonMaggot/Dungeon2
    protected void BeginAttack()
    {
        if (m_currentAction == EntityActions.Idle)
        {
            m_currentAction           = EntityActions.Attack;
            m_actionTimer             = m_attackSeconds;
            m_actionMidEventTriggered = false;
            m_attackTargetTile        = m_tilePos + m_facingDirection;

            float randomValue = Random.value;
            if (randomValue >= 0.0f && randomValue < 0.25f)
            {
                m_AudioSource.PlayOneShot(m_AttackSound1);
            }
            else if (randomValue >= 0.25f && randomValue < 0.50f)
            {
                m_AudioSource.PlayOneShot(m_AttackSound2);
            }
            else if (randomValue >= 0.50f && randomValue < 0.75f)
            {
                m_AudioSource.PlayOneShot(m_AttackSound3);
            }
            else
            {
                m_AudioSource.PlayOneShot(m_AttackSound4);
            }
        }
    }
コード例 #4
0
ファイル: Character.cs プロジェクト: DungeonMaggot/Dungeon2
 protected void BeginRotation(TurnDirection direction)
 {
     if (m_currentAction == EntityActions.Idle)
     {
         m_faceDirectionTarget = RotateVec2IntBy90Degrees(m_facingDirection, direction);
         m_currentAction       = EntityActions.Rotate;
         m_actionTimer         = m_rotateSeconds;
     }
 }
コード例 #5
0
ファイル: Character.cs プロジェクト: DungeonMaggot/Dungeon2
    // Update is called once per frame
    protected override void Update()
    {
        base.Update();

        switch (m_currentAction)
        {
        default:
        { } break;

        case EntityActions.Move:
        {
            AnimateMove();
            if (m_actionDone)
            {
                m_tilePos = m_moveTargetPos;
                m_gameManagerReference.ClearTileReservation(this.gameObject);
            }
        } break;

        case EntityActions.Rotate:
        {
            AnimateRotation();
            if (m_actionDone)
            {
                m_facingDirection = m_faceDirectionTarget;
            }
        } break;

        case EntityActions.Attack:
        {
            AnimateAttack();
        } break;

        case EntityActions.Die:
        {
            DieAnimate();
            if (m_actionDone)
            {
                Dead();
            }
        } break;
        }

        if (m_actionDone)
        {
            if (m_hitpoints <= 0)
            {
                m_currentAction = EntityActions.Dead;
            }
            else
            {
                m_currentAction = EntityActions.Idle;
            }
        }
    }
コード例 #6
0
ファイル: Character.cs プロジェクト: DungeonMaggot/Dungeon2
    protected void BeginMove(MoveDirection direction)
    {
        if (m_currentAction == EntityActions.Idle)
        {
            Vector2Int moveDirection = m_facingDirection;
            switch (direction)
            {
            default:
            { } break;

            case MoveDirection.Backward:
            {
                moveDirection *= -1;
            } break;

            case MoveDirection.Left:
            {
                moveDirection = RotateVec2IntBy90Degrees(moveDirection, TurnDirection.Left);
            } break;

            case MoveDirection.Right:
            {
                moveDirection = RotateVec2IntBy90Degrees(moveDirection, TurnDirection.Right);
            } break;
            }
            m_moveTargetPos = m_tilePos + moveDirection;

            if (m_gameManagerReference.IsMoveValid(m_tilePos, m_moveTargetPos))
            {
                m_currentAction = EntityActions.Move;
                m_actionTimer   = m_moveSeconds;
                float randomValue = Random.value;
                if (randomValue >= 0.0f && randomValue < 0.25f)
                {
                    m_AudioSource.PlayOneShot(m_StepSound1);
                }
                else if (randomValue >= 0.25f && randomValue < 0.50f)
                {
                    m_AudioSource.PlayOneShot(m_StepSound2);
                }
                else if (randomValue >= 0.50f && randomValue < 0.75f)
                {
                    m_AudioSource.PlayOneShot(m_StepSound3);
                }
                else
                {
                    m_AudioSource.PlayOneShot(m_StepSound4);
                }
                m_gameManagerReference.ReserveTilePos(this.gameObject, m_moveTargetPos);
            }
        }
    }
コード例 #7
0
 protected virtual void onEntityAction(int entityId, EntityActions action)
 {
     Notify?.Invoke(this, new EntityArgs(entityId, action));
 }
コード例 #8
0
 public EntityArgs(int entityId, EntityActions action)
 {
     EntityId = entityId;
     Action   = action;
 }
        /// <summary>
        /// Show the Entitu in EntyForm
        /// With default value of objet
        /// and Defailt value of filter
        /// </summary>
        public virtual void ShowEntity(Dictionary <string, object> CritereRechercheFiltre, EntityActions EntityAction)
        {
            // Generate the the form if is note generated
            CreateFieldIfNotGenerated();

            // set SetpInitalize to true to not execute EventsChange
            isStepInitializingValues = true;

            BaseEntity entity     = this.Entity;
            Type       typeEntity = this.EntityBLO.TypeEntity;

            foreach (PropertyInfo item in ListeChampsFormulaire())
            {
                ConfigProperty configProperty = new ConfigProperty(item, this.ConfigEntity);
                // Param
                WriteEntity_To_EntryForm_Param param = new WriteEntity_To_EntryForm_Param();
                param.Entity                 = this.Entity;
                param.ConfigProperty         = configProperty;
                param.CritereRechercheFiltre = CritereRechercheFiltre;
                param.FromContainer          = ConteneurFormulaire;
                param.EntityAction           = EntityAction;

                // Get FieldTraitement Type
                IFieldTraitements fieldTraitement = BaseFieldTraitement.CreateInstance(configProperty);

                // Invok Create Field Method
                fieldTraitement.ShowEntity_To_EntryForm(param);
            }
            // Fin de la phase d'initialisaiton
            this.isStepInitializingValues = false;
        }
コード例 #10
0
 public ScriptGenericEntityAction(Entity e, EntityActions action)
 {
     this.e = e;
     this.action = action;
 }
コード例 #11
0
 public BaseProperty()
 {
     _actions = new EntityActions();
 }