示例#1
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        string Tag = collision.gameObject.tag;

        if (Tag == "PlayerCharacter" || Tag == "EnemyCharacter")
        {
            CBaseCharacter Character = collision.gameObject.GetComponent <CBaseCharacter>();
            Character.Stop();
            collision.gameObject.transform.position = Character.PrePos;
        }
    }
示例#2
0
    public override void FrameEvent(int Frame)
    {
        switch (EventFrames[Frame])
        {
        case EEventFrame.Damage:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.Combo2Damage();
        }
        break;

        case EEventFrame.Effect:
            break;

        case EEventFrame.Camera:
            break;

        case EEventFrame.ComboEnable:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.ComboEnable();
        }
        break;

        case EEventFrame.ComboDisable:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.ComboDisable();
        }
        break;

        case EEventFrame.ComboEnd:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.ComboEnd();
        }
        break;

        case EEventFrame.SpecialPointEnable:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.SpecialPointEnable();
        }
        break;

        case EEventFrame.SpecialPointDisable:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.SpecialPointDisable();
        }
        break;
        }
    }
    private void OnTriggerEnter2D(Collider2D other)
    {
        string OtherTag = other.gameObject.tag;

        if (OtherTag == "PlayerCharacter" || OtherTag == "EnemyCharacter")
        {
            if (Owner.tag != OtherTag)
            {
                CBaseCharacter DamagedCharacter = other.gameObject.GetComponent <CBaseCharacter>();
                DamagedCharacter.Hit(Damage, Owner, HitMove, false, EHitAniType.Type1);
            }
        }
    }
示例#4
0
 void OnCollisionEnter2D(Collision2D myCollision)
 {
     if (myCollision.gameObject.tag == targetTag)
     {
         CBaseCharacter collisionBehaviour = myCollision.gameObject.GetComponent <CBaseCharacter> ();
         //Патрону все равно какой именно наследник MonsterBehaviour мы получим.
         if (collisionBehaviour != null && collisionBehaviour.isLive())
         {            //Если MonsterBehaviour eсть
             collisionBehaviour.setDamage(damage);
             collisionBehaviour.shootForwardDirection = forwardDirection;
         }
     }
     //после попадания в любой обьект, патрон исчезает
     Destroy(gameObject);
 }
示例#5
0
    protected new void Update()
    {
        if (bPlayingAni)
        {
            CBaseCharacter Char = gameObject.GetComponentInParent <CBaseCharacter>();
            InitAngle(Char.RotateAngle);
            //spriteRenderer.flipX = 0.0f == Char.RotateAngle ? true : false;
            //Vector3 NewPos = DefaultPos;
            //NewPos.x = 0.0f == Char.RotateAngle ? -DefaultPos.x : DefaultPos.x;
            //transform.localPosition = NewPos;
            //CharRotateAngle = Char.RotateAngle;
        }

        base.Update();
    }
示例#6
0
    public override void FrameEvent(int Frame)
    {
        switch (EventFrames[Frame])
        {
        case EEventFrame.Damage:
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.ParringAttackDamage();
            break;

        case EEventFrame.Effect:
            break;

        case EEventFrame.Camera:
            break;
        }
    }
示例#7
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        if (tag == "PlayerCharacter" || tag == "EnemyCharacter")
        {
            CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D CMovingTrap");

            CBaseCharacter character = collision.gameObject.GetComponent <CBaseCharacter>();
            if (character.curState == EState.Dodge || character.curState == EState.Die)
            {
                return;
            }

            character.Hit(Damage, gameObject, HitMove, false, EHitAniType.Type1);
        }
    }
示例#8
0
    public override bool FindNearestTarget()
    {
        if (TargetObj)
        {
            return(true);
        }

        bool    bFinded         = false;
        float   CheckTargetDist = 100.0f;
        Vector3 CurPos          = gameObject.transform.position;

        GameObject[][] FindedObjs = new GameObject[2][];
        FindedObjs[0] = GameObject.FindGameObjectsWithTag("PlayerCharacter");
        FindedObjs[1] = GameObject.FindGameObjectsWithTag("EnemyCharacter");

        for (int i = 0; i < 2; ++i)
        {
            for (int j = 0; j < FindedObjs[i].Length; ++j)
            {
                if (FindedObjs[i][j].GetInstanceID() == gameObject.GetInstanceID())
                {
                    continue;
                }

                CBaseCharacter FindChar = FindedObjs[i][j].GetComponent <CBaseCharacter>();
                if (FindChar.curState != EState.Die)
                {
                    // PlayerCharacter 일때, 팀체크
                    if (i == 0 && FindChar.TeamType == TeamType)
                    {
                        continue;
                    }

                    float TargetDist = Vector3.Distance(FindedObjs[i][j].transform.position, CurPos);
                    if (TargetDist < CheckTargetDist && TargetDist <= EyeSight)
                    {
                        CheckTargetDist = TargetDist;
                        TargetObj       = FindedObjs[i][j];
                        bFinded         = true;
                    }
                }
            }
        }
        return(bFinded);
    }
示例#9
0
    public override void FrameEvent(int Frame)
    {
        switch (EventFrames[Frame])
        {
        case EEventFrame.SuperArmorEnable:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.bSuperArmor = true;
        }
        break;

        case EEventFrame.SuperArmorDisable:
        {
            CBaseCharacter Character = gameObject.GetComponentInParent <CBaseCharacter>();
            Character.bSuperArmor = false;
        }
        break;
        }
    }
示例#10
0
    protected void OnTriggerEnter2D(Collider2D collision)
    {
        if (curState == EState.Die)
        {
            return;
        }

        string tag = collision.gameObject.tag;

        if (tag == "EnemyCharacter" || tag == "PlayerCharacter")
        {
            if (tag == "EnemyCharacter")
            {
                CBaseCharacter character = collision.gameObject.GetComponent <CBaseCharacter>();
                if (character.curState != EState.Die)
                {
                    Idle();
                }
            }
            Stop();
        }
    }
示例#11
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        if (tag == "PlayerCharacter" || tag == "EnemyCharacter")
        {
            CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D DownStairs");

            CBaseCharacter character = collision.gameObject.GetComponent <CBaseCharacter>();
            if (character.curState == EState.Dodge)
            {
                return;
            }
            if (character.IsTeleport())
            {
                character.Teleport(false);
                CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D DownStairs return");
                return;
            }


            GameObject[] find_objects = GameObject.FindGameObjectsWithTag("UpStairs");
            foreach (GameObject find_object in find_objects)
            {
                CUpStairs stairs = find_object.GetComponent <CUpStairs>();
                if (stairs.Index == LinkIndex)
                {
                    Vector3 NewPos = find_object.transform.position;
                    NewPos.z = 0.0f;
                    collision.gameObject.transform.position = NewPos;
                    character.Teleport(true);

                    CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D DownStairs teleport");
                    break;
                }
            }
        }
    }
示例#12
0
 public void Init(CBaseCharacter InCharacter)
 {
     Character = InCharacter;
 }