示例#1
0
 public void carry(vars.player_id pid)
 {
     Debug.Log(pid.ToString());
         carried_by = pid;
         rd.useGravity = false;
       rd.rotation = init_rot;
         last_contact = pid;
 }
示例#2
0
    public void add_force(Vector3 vel)
    {
        Debug.Log("add force :" + vel);
        carried_by = vars.player_id.none;
        last_contact = vars.player_id.none;
        rd.velocity = vel;
        rd.useGravity = true;

        //rd.AddForce(vel);

        Debug.Log(rd.velocity);
    }
示例#3
0
    public void decarry()
    {
        // this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y + 1.0f, this.transform.position.z);
        rd.useGravity = true;

        decarry_timer = decarry_timer_max;
        this.GetComponent<SphereCollider>().enabled = false;

        carried_by = vars.player_id.none;
        rd.useGravity = true;
            rd.AddForce(decarray_velocity_add);
            play_hit_animation();
    }
示例#4
0
    public void decarry_collide(Vector3 vel)
    {
        carried_by = vars.player_id.none;
        last_contact = vars.player_id.none;

        wall_collide_colluder_disable_timer = wall_collide_collider_disable_timer_max;
        wall_collide_collider_disabled = true;

        add_force(vel);

        play_hit_animation();

        //this.GetComponent<SphereCollider>().enabled = false;
    }
示例#5
0
 // Use this for initialization
 void Start()
 {
     //   spawned = false;
     //  ms_skull_mat = ms_skull.GetComponent<Material>();
     animator = skull_ob.GetComponent<Animator>();
     asource = this.GetComponent<AudioSource>();
     this.name = "ball";
     this.transform.position = GameObject.Find("pause_position").transform.position;
     rd = this.GetComponent<Rigidbody>();
     init_rot = rd.rotation;
     hits = 0;
     carried_by = vars.player_id.none;
     carried_by_last_frame = vars.player_id.none;
     particles = particle_holder.GetComponent<ParticleSystem>();
     p1pc = player1_scrpit_obj.GetComponent<adv_playercontroller>();
     p2pc = player2_scrpit_obj.GetComponent<adv_playercontroller>();
     p3pc = player3_scrpit_obj.GetComponent<adv_playercontroller>();
     p4pc = player4_scrpit_obj.GetComponent<adv_playercontroller>();
     rotate_font();
     set_to_pause_pos();
 }
示例#6
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("ball trigger enter by" + other.transform.parent.gameObject.tag);

        if (other.transform.parent.gameObject.tag == "Player" && !wall_collide_collider_disabled && game_manager.gstate == vars.game_state.playing)
        {
            //NUR WENN NICHT GECARRIED WIRD DANN WECHSELN
            if (!is_carrying())
            {
                last_contact = other.transform.parent.gameObject.GetComponent<adv_playercontroller>().player_id;
            }

         if(carried_by == vars.player_id.none  ){
           if (!other.transform.parent.gameObject.GetComponent<adv_playercontroller>().is_kocked && !is_carrying())
           {
         other.transform.parent.gameObject.GetComponent<adv_playercontroller>().play_pickup(); //play pickup animation
         carry(other.transform.parent.gameObject.GetComponent<adv_playercontroller>().player_id);
           }

         }

        }
    }
示例#7
0
    public void spawn_real()
    {
        Debug.Log("spawn-real");
        rotate_font();
        last_contact = vars.player_id.none;
        carried_by = vars.player_id.none;
        rd.useGravity = true;
        this.rd.velocity = Vector3.zero;

        float rndnum = (int)Random.Range(1.0F, 101.0F);

        if (rndnum < (100 - 33.0f - 33.0f))
        {
            this.transform.position = GameObject.Find("ball_spawn_pos_1").gameObject.transform.position;
        }
        else if (rndnum >= 33.0f && rndnum < (100 - 33.0f))
        {
            this.transform.position = GameObject.Find("ball_spawn_pos_2").gameObject.transform.position;
        }
        else
        {
            this.transform.position = GameObject.Find("ball_spawn_pos_3").gameObject.transform.position;
        }
    }
示例#8
0
 public void set_to_pause_pos()
 {
     this.transform.position = GameObject.Find("pause_position").transform.position;
     rd.useGravity = false;
     carried_by = vars.player_id.none;
     carried_by_last_frame = vars.player_id.none;
     last_contact = vars.player_id.none;
 }
示例#9
0
    public void decarry_fly(vars.player_id pid, float _decarray_velocity_add)
    {
        rd.useGravity = false;
        Debug.Log("decarry fly");

            carried_by = vars.player_id.none;
           // last_contact = pid;
          rd.velocity =  new Vector3(-_decarray_velocity_add, 0.0f,0.0f) ;
          play_hit_animation();
    }