Beispiel #1
0
    public static void EnemyFrozen(float speed)
    {
        //将不在同一维度的敌人冰封起来
        for (int i = 0; i < Master.bodyCollector.Count; i++)
        {
            humanBody tempBody = Master.bodyCollector[i];

            if (tempBody.GetComponent <AIController>() != null)   //为敌人
            {
                if (tempBody.tenetDirection == 0)
                {
                    tempBody.GetAnimator().SetFloat("Speed", speed);
                }
            }
        }
    }
Beispiel #2
0
    public static void CalculateStageEnemy()
    {
        //计算阶段敌人
        // 正常时死亡的人数,当cd变为0时这个值变为固定值
        for (int i = 0; i < Master.bodyCollector.Count; i++)
        {
            humanBody tempBody = Master.bodyCollector[i];

            if (tempBody.tenetDirection == 1)
            {
                if (tempBody.GetAnimator().GetBool("dead") == true)
                {
                    Master.stageKilliedNum++;
                }
            }
        }
    }
Beispiel #3
0
    public void CalculateEnemy()
    {
        Master.totalEnemyNum = 0;
        //统计敌人
        for (int i = 0; i < Master.bodyCollector.Count; i++)
        {
            humanBody tempBody = Master.bodyCollector[i];

            if (tempBody.GetComponent <AIController>() != null)
            {
                //表示有AI控件,所以是敌人,此时totalNum++
                if (Master.currentDirection == 1)
                {
                    if (tempBody.tenetDirection == Master.currentDirection)   //在正向时则被标记的反向敌人不算在敌人总数中
                    {
                        Master.totalEnemyNum++;
                    }
                }

                if (Master.currentDirection == 0)    //反向时所有敌人都添加
                {
                    Master.totalEnemyNum++;
                }
            }
        }

        //进入逆转门后每个dead为true的敌人都可以加killedNum;
        Master.killedEnemyNum = 0;

        if (Master.currentDirection == 1)
        {
            //正常时死亡的人数,当cd变为0时这个值变为固定值
            for (int i = 0; i < Master.bodyCollector.Count; i++)
            {
                humanBody tempBody = Master.bodyCollector[i];

                if (tempBody.GetComponent <AIController>() != null)   //为敌人
                {
                    if (tempBody.tenetDirection == 1)
                    {
                        if (tempBody.GetAnimator().GetBool("dead") == true)
                        {
                            Master.killedEnemyNum++;
                        }
                    }
                }
            }
        }

        if (Master.currentDirection == 0)
        {
            //逆转时死亡的人数
            for (int i = 0; i < Master.bodyCollector.Count; i++)
            {
                humanBody tempBody = Master.bodyCollector[i];

                if (tempBody.GetComponent <AIController>() != null)   //为敌人
                {
                    if (tempBody.tenetDirection == 0)
                    {
                        if (tempBody.GetAnimator().GetBool("dead") == true)
                        {
                            Master.killedEnemyNum++;
                        }
                    }
                }
            }
        }

        Master.killedEnemyNum += Master.stageKilliedNum;   //如果在逆转阶段则加上之前的数量


        //Debug.Log(Master.killedEnemyNum + " " + Master.totalEnemyNum);
    }
Beispiel #4
0
    //awdqwfqwwad
    private Vector2 Replay(Egg egg, int direction)
    {
        Vector2 position = transform.position;

        //direction决定是否和egg原有的direction一致,如果direction都为1则一致,为-1则相反

        //根据参数来进行各自的动作
        switch (egg.movement)
        {
        case ActionEnum.movement.walk:
            position = body.Walk(direction * -egg.parm1, egg.position);
            break;

        case ActionEnum.movement.attack:
            position = body.Attack(body.direction, true, egg.position);
            //Debug.Log("Attack");
            break;

        case ActionEnum.movement.jump:
            position = body.Jumping(1, (int)egg.parm2, egg.position);      //实现跳一百帧就是插入一百次即可
            //Debug.Log(egg.parm1 + "   " + egg.parm2);
            break;

        case ActionEnum.movement.dead:
            //Debug.Log("复活");
            body.Dead(1);
            position = egg.position;      //可能也要赋予位置
            break;

        case ActionEnum.movement.gravity:
            position = body.Gravity(egg.position);
            //Debug.Log("gravity");
            break;

        case ActionEnum.movement.bulletMove:
            position = egg.position;
            //Debug.Log("gravity");
            break;

        case ActionEnum.movement.bulletBack:

            transform.GetComponent <bullet>().speed = direction * -egg.parm1;

            //gameObject.SetActive(true);
            //Debug.Log(egg.parm1);
            GetComponent <BoxCollider2D>().enabled = true;

            //修改子弹的z坐标为-3
            transform.position = new Vector3(egg.position.x, egg.position.y, 3);

            position = transform.position;
            //Debug.Log(transform.position);
            //Debug.Log("gravity");
            break;

        case ActionEnum.movement.bulletGone:
            position = egg.position;
            //当frame还可以计入事件帧时才会销毁
            if (direction == Master.currentDirection)
            {
                Debug.Log("bullet销毁");
                Destroy(gameObject, 0);        //去除子弹
            }

            break;

        case ActionEnum.movement.targetConfirm:
            position = egg.position;
            body.GetAnimator().SetFloat("Speed", 1f);
            //body.SetFloat("Speed", 1f);
            body.transform.Find("CursorCollider").GetComponent <SpriteRenderer>().color = Color.white;

            body.tenetDirection = 1;         //将其状态改回原来的
            break;

        case ActionEnum.movement.findMainguy:
            position = egg.position;

            if (body.tenetDirection == Master.currentDirection)
            {
                body.target = null;
            }

            break;

        default:
            break;
        }

        return(position);

        //123
    }