コード例 #1
0
    void OnCollisionEnter2D(Collision2D other)
    {
        MoveWithInput player = other.gameObject.GetComponent <MoveWithInput>();

        if (player != null)
        {
            player.ChangeHealth(-1);
        }
    }
コード例 #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        MoveWithInput controller = other.GetComponent <MoveWithInput>();

        if (controller != null)
        {
            if (controller.currentHealth < controller.maxHealth)
            {
                controller.ChangeHealth(1);
                Destroy(gameObject);
            }
        }
    }
コード例 #3
0
        void OnTriggerEnter2D(Collider2D otherP)
        {
            MoveWithInput controller = otherP.GetComponent <MoveWithInput>();

            if (controller != null)
            {
                if (ShouldConsumePill(controller))
                {
                    ConsumePill(controller);
                    PillPusher.PushPill(transform.position);
                    Destroy(gameObject);
                }
            }
        }
コード例 #4
0
ファイル: SpeedPill.cs プロジェクト: jezaboyd/ITFOLLOWS
 protected override void ConsumePill(MoveWithInput controller)
 {
     controller.Consume(this);
 }
コード例 #5
0
ファイル: SpeedPill.cs プロジェクト: jezaboyd/ITFOLLOWS
 protected override bool ShouldConsumePill(MoveWithInput controller)
 {
     return(true);
 }
コード例 #6
0
ファイル: CollectiblePill.cs プロジェクト: jezaboyd/ITFOLLOWS
 protected override bool ShouldConsumePill(MoveWithInput controller)
 {
     return(controller.currentPill < controller.maxPill);
 }
コード例 #7
0
ファイル: CollectiblePill.cs プロジェクト: jezaboyd/ITFOLLOWS
 protected override void ConsumePill(MoveWithInput controller)
 {
     controller.ChangePill(1);
 }
コード例 #8
0
 private void Start()
 {
     _moveScript   = GetComponent <MoveWithInput>();
     _rotateScript = GetComponent <RotateWithInput>();
 }
コード例 #9
0
 protected abstract void ConsumePill(MoveWithInput controller);
コード例 #10
0
 protected abstract bool ShouldConsumePill(MoveWithInput controller);