private moveGrounds mG;              //地面的脚本

    // Start is called before the first frame update
    void Start()
    {
        //获得两个player的脚本对象
        moveScript   = GameObject.FindWithTag("player").GetComponent <PlayerControl>();
        moveScript_2 = GameObject.FindWithTag("player_2").GetComponent <Player2Control>();
        mG           = GameObject.FindWithTag("grounds").GetComponent <moveGrounds>();
    }
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("1 Initing!!!!!!!!!!!!!!!!!!!!!!!!!!");

        playerHealth = GameObject.Find("PlayerHealth");
        rigidbody    = GetComponent <Rigidbody2D>();
        if (player.name.Equals("player1"))
        {
            KeyCodeSet[0] = KeyCode.W;
            KeyCodeSet[1] = KeyCode.A;
            KeyCodeSet[2] = KeyCode.S;
            KeyCodeSet[3] = KeyCode.D;

            KeyCodeSet[4] = KeyCode.J;
            KeyCodeSet[5] = KeyCode.K;
            KeyCodeSet[6] = KeyCode.U;
            KeyCodeSet[7] = KeyCode.I;
            KeyCodeSet[8] = KeyCode.O;
            KeyCodeSet[9] = KeyCode.L;
        }
        if (player.name.Equals("player2"))
        {
            KeyCodeSet[0] = KeyCode.UpArrow;
            KeyCodeSet[1] = KeyCode.LeftArrow;
            KeyCodeSet[2] = KeyCode.DownArrow;
            KeyCodeSet[3] = KeyCode.RightArrow;

            KeyCodeSet[4] = KeyCode.Keypad1;
            KeyCodeSet[5] = KeyCode.Keypad2;
            KeyCodeSet[6] = KeyCode.Keypad4;
            KeyCodeSet[7] = KeyCode.Keypad5;
            KeyCodeSet[8] = KeyCode.Keypad6;
            KeyCodeSet[9] = KeyCode.Keypad3;
        }
        animator = GetComponent <Animator>();

        animation = GetComponent <Animation>();
        ac1       = GetComponent <AnimationCreator>().Create("attack"); ac2 = GetComponent <AnimationCreator>().Create("Guard"); ac3 = GetComponent <AnimationCreator>().Create("attack2");

        throwArea = GameObject.Find(name + "/Skeleton/rootBone/rightArm/rightArm2/rightHand/throwArea");
        bluebar   = GameObject.FindWithTag("BlueBar_1").GetComponent <BlueBar>();
        gems[0]   = GameObject.FindWithTag("Gem_1_1").GetComponent <Gem>(); gems[1] = GameObject.FindWithTag("Gem_1_2").GetComponent <Gem>(); gems[2] = GameObject.FindWithTag("Gem_1_3").GetComponent <Gem>();

        playerHealth.GetComponent <PlayerHealth>().init();
        BattlePara.Init();

        //整合的(设置Tag)
        moveScript_2 = GameObject.FindWithTag("player_2").GetComponent <Player2Control>();
        //riBody = GetComponent<Rigidbody2D>();//用来处理抖动的问题
        mG = GameObject.FindWithTag("grounds").GetComponent <moveGrounds>();
    }
    private bool CanCollider = true;//用来判断自身是否碰到便边界

    //private Rigidbody2D riBody;
    void Start()
    {
        moveScript_2 = GameObject.FindWithTag("player_2").GetComponent <Move_2>();
        //riBody = GetComponent<Rigidbody2D>();//用来处理抖动的问题
        mG = GameObject.FindWithTag("grounds").GetComponent <moveGrounds>();
    }
Exemple #4
0
    private bool CanCollider = true; //用来判断自身是否碰到便边界

    // Start is called before the first frame update
    void Start()
    {
        moveScript = GameObject.FindWithTag("player").GetComponent <Move>();//获得脚本的对象
        mG         = GameObject.FindWithTag("grounds").GetComponent <moveGrounds>();
    }