Ejemplo n.º 1
0
    //public bool Coroutine_Flag{ get { return Coroutine_flag; } set { Coroutine_flag = value; } }

    void Start()
    {
        JudgeNum        = 0;
        Late_Coroutine  = false;
        State_Coroutine = false;
        Is_stop         = false;
        //sn_area = transform.Find("SnapField/ougi/円柱.001").gameObject;
        rotationrate = 20;
        colb         = this.gameObject.GetComponent <CollisionBall>();
        //  Debug.Log(colb.w_p);

        //Coroutine_flag = true;
        Isrunning = false;
        Is_shot   = false;
        camera    = transform.Find("Main Camera");
        rgd       = GetComponent <Rigidbody>();
        goal_1    = GameObject.Find("Goal_1");
        goal_2    = GameObject.Find("Goal_2");
        if (myteam == 1)
        {
            enemyteam  = 2;
            Goal_enemy = goal_2;
        }
        else if (myteam == 2)
        {
            enemyteam  = 1;
            Goal_enemy = goal_1;
        }
        goalkepper = GameObject.Find("goalkeeper" + enemyteam);
        //Debug.Log(goalkepper);
        goalpoint_enemy = GameObject.Find("goal_point" + enemyteam);
        goalpoint_my    = GameObject.Find("goal_point" + myteam);
        if (SceneManager.GetActiveScene().name == "mian")
        {
            NPCSystem = GameObject.Find("GameSystem_Main").GetComponent <NPCSystemMain>();
        }
        if (SceneManager.GetActiveScene().name == "FreePractice")
        {
            NPCSystem = GameObject.Find("GameSystem_FreePractice").GetComponent <NPCSystemMain>();
        }


        StateYou = "null";
    }
Ejemplo n.º 2
0
    private void OnCollisionExit(Collision coll)
    {
        if (coll.gameObject.tag == "SideFences")
        {
            if (joint_man != null)
            {
                if (Is_enter)
                {
                    CollisionBall collision = joint_man.GetComponent <CollisionBall>();

                    /*
                     * fj.breakForce = originalForce;
                     * fj.breakTorque = originalTorque;
                     * collision.breakForce = originalForce;
                     * collision.breakTorque = originalTorque;
                     */
                    this.gameObject.GetComponent <Rigidbody>().mass = 0.4f;

                    if (joint_man.name == "Player")
                    {
                        Physics.IgnoreLayerCollision(Player, soccerball, false);
                        Physics.IgnoreLayerCollision(SnapField, soccerball, false);

                        colb             = joint_man.GetComponent <CollisionBall>();
                        colb.first_force = 100000f;
                    }

                    if (joint_man.name == "NPC1" || joint_man.name == "NPC2")
                    {
                        // Debug.Log("離れた");
                        colb             = joint_man.GetComponent <CollisionBall>();
                        colb.first_force = 100000f;
                        this.gameObject.GetComponent <Rigidbody>().mass = 0.4f;
                    }

                    Is_enter = false;
                }
            }
        }
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     coll      = GetComponent <CollisionBall>();
     rigidbody = soccerball.GetComponent <Rigidbody>();
     Is_shot   = false;
 }
Ejemplo n.º 4
0
    private void OnCollisionEnter(Collision other)
    {
        //Debug.Log(other.gameObject.name);



        if (other.gameObject.tag == "SideFences")
        {
            //
            if (joint_man != null)
            {
                if (!Is_enter)
                {
                    //Debug.Log(joint_man.gameObject.name);

                    Is_enter = true;
                    fj       = joint_man.GetComponent <FixedJoint>();

                    /*
                     * originalForce = fj.breakForce;
                     * originalTorque = fj.breakTorque;
                     * fj.breakForce = changedForce;
                     * fj.breakTorque = changedTorque;
                     */

                    if (joint_man.name == "Player")
                    {
                        //Debug.Log(joint_man.gameObject.transform.Find("ball_spot").transform.position);

                        //Physics.IgnoreLayerCollision(Player,soccerball);
                        //Physics.IgnoreLayerCollision(SnapField, soccerball);
                        //Physics.IgnoreLayerCollision(Team2, soccerball);

                        this.gameObject.GetComponent <Rigidbody>().mass = 1.0f;

                        this.gameObject.GetComponent <Rigidbody>().isKinematic = true;

                        colb             = joint_man.GetComponent <CollisionBall>();
                        colb.first_force = 0.0f;
                        fj.breakForce    = 0;
                        fj.breakTorque   = 0;
                        //this.gameObject.GetComponent<Rigidbody>().mass = 0.4f;
                    }

                    if (joint_man.name == "NPC1" || joint_man.name == "NPC2")
                    {
                        //Debug.Log("くっ付く");
                        //Debug.Log(joint_man.gameObject.transform.Find("ball_spot").transform.position);

                        //Physics.IgnoreLayerCollision(Player,soccerball);
                        //Physics.IgnoreLayerCollision(SnapField, soccerball);
                        //Physics.IgnoreLayerCollision(Team2, soccerball);

                        this.gameObject.GetComponent <Rigidbody>().mass = 0.00000000003f;

                        this.gameObject.GetComponent <Rigidbody>().isKinematic = true;

                        colb             = joint_man.GetComponent <CollisionBall>();
                        colb.first_force = 0.0f;
                        //fj.breakForce = 50000000000.0f;
                        //fj.breakTorque = 100000000000.0f;
                        //this.gameObject.GetComponent<Rigidbody>().mass = 0.4f;
                    }
                }
            }
        }
        else
        {
            this.gameObject.GetComponent <Rigidbody>().mass        = 0.4f;
            this.gameObject.GetComponent <Rigidbody>().isKinematic = false;
        }
    }