Ejemplo n.º 1
0
            public override void Exit(GameObject g_player, GameObject g_wear)
            {
                Debug.Log("Exit!");

                CS_PlayerControl t_playerControl = g_player.GetComponent <CS_PlayerControl> ();

                if (t_playerControl == null)
                {
                    return;
                }

                int t_index = CS_PlayerManager.Instance.GetIndexNumber(t_playerControl.GetTeam());

                if (myRuleInfo.isTeamBased)
                {
                    if (myWears.IndexOf(g_wear) == t_index)
                    {
                        isPlayerWearing [t_index] = false;
                        isOn [t_index]            = false;
                    }
                }
                else
                {
                    isPlayerWearing [t_index] = false;
                    isOn [t_index]            = false;
                }
            }
Ejemplo n.º 2
0
            public override void Enter(GameObject g_player, GameObject g_goal)
            {
//				Debug.Log ("Enter!");
//				if (!isInitialized)
//					return;



                CS_PlayerControl t_playerControl = g_player.GetComponent <CS_PlayerControl> ();

                if (t_playerControl == null)
                {
                    return;
                }

                int t_index = CS_PlayerManager.Instance.GetIndexNumber(t_playerControl.GetTeam());

//				if (isActive [t_index] == false)
//					return;

                if (myRuleInfo.isTeamBased)
                {
                    if (myAreas.IndexOf(g_goal.GetComponentInChildren <CS_Prop_Area> ()) == t_index)
                    {
                        isPlayerOnHill [t_index] += 1;
//						Debug.Log ("enter3");
                        isOn [t_index] = true;
                    }
                }
                else
                {
                    isPlayerOnHill [t_index] += 1;
                }
            }
Ejemplo n.º 3
0
 public void Drop(CS_PlayerControl g_holder)
 {
     myHolder = null;
     foreach (CS_Rule f_rule in myRules)
     {
         f_rule.Exit(g_holder.gameObject, this.gameObject);
     }
 }
Ejemplo n.º 4
0
    void Start()
    {
        // find the player instance
        myPlayer = CS_PlayerControl.Instance;

        // calculate the full size according to map
        myFullSize = CalculateFullSize();
    }
Ejemplo n.º 5
0
//	// Update is called once per frame
//	void Update () {
//
//	}

    void OnTriggerEnter(Collider g_collider)
    {
        CS_PlayerControl t_playerControl = g_collider.gameObject.GetComponent <CS_PlayerControl> ();

        if (t_playerControl != null)
        {
            t_playerControl.SetTeam(myTeamNumber);
        }

        CS_PlayerManager.Instance.CheckTeam();
    }
Ejemplo n.º 6
0
 public void SetMyHolder(CS_PlayerControl g_holder)
 {
     if (myHolder != null)
     {
         myHolder.DropWearing();
     }
     myHolder = g_holder;
     foreach (CS_Rule f_rule in myRules)
     {
         f_rule.Enter(g_holder.gameObject, this.gameObject);
     }
 }
Ejemplo n.º 7
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance = this;
        }

        // find my rigidBody
        myRigidbody = this.GetComponent <Rigidbody> ();
    }
Ejemplo n.º 8
0
            public override void Exit(GameObject g_player, GameObject g_goal)
            {
                //				Debug.Log ("Exit!");
//				if (!isInitialized)
//					return;

                CS_PlayerControl t_playerControl = g_player.GetComponent <CS_PlayerControl> ();

                if (t_playerControl == null)
                {
                    return;
                }

                int t_index = CS_PlayerManager.Instance.GetIndexNumber(t_playerControl.GetTeam());

                if (myRuleInfo.isTeamBased)
                {
                    if (myAreas.IndexOf(g_goal.GetComponentInChildren <CS_Prop_Area> ()) == t_index)
                    {
                        isPlayerOnHill [t_index] -= 1;
                        if (isPlayerOnHill [t_index] < 0)
                        {
                            isPlayerOnHill [t_index] = 0;
                            Debug.LogWarning("player number on the hill is less than 0?!");
                        }
                        isOn [t_index] = false;
                    }
                }
                else
                {
                    isPlayerOnHill [t_index] -= 1;
                    if (isPlayerOnHill [t_index] < 0)
                    {
                        isPlayerOnHill [t_index] = 0;
                        Debug.LogWarning("player number on the hill is less than 0?!");
                    }
                }
            }
Ejemplo n.º 9
0
    public void PickUpTool()
    {
        if (isUsed == true)
        {
            return;
        }

        CS_PlayerControl t_myPlayerControl = GameObject.FindGameObjectWithTag(CS_Global.NAME_PLAYER).GetComponent <CS_PlayerControl> ();
        CS_PlayerPocket  t_myPlayerPocket  = GameObject.Find(CS_Global.NAME_PLAYERPOCKRT).GetComponent <CS_PlayerPocket> ();

        if (t_myPlayerControl.GetIsDead() == true)
        {
            return;
        }
        if (t_myPlayerPocket.GetMyTool() == CS_Global.TOOL_FLOWER)
        {
            t_myPlayerPocket.DestoryTool();
            myFlower.SetActive(true);
            myParticle.SetActive(false);
            myGhost.SendMessage("Disappear");
            isUsed   = true;
            this.tag = CS_Global.TAG_UNTAGGED;
        }
    }
Ejemplo n.º 10
0
    void OnCollisionEnter(Collision g_collision)
    {
        if (onKnockedOut)
        {
            return;
        }

//		Debug.Log (g_collision.gameObject.name + ": " + g_collision.impulse.sqrMagnitude);
        Rigidbody t_colRigidbody = g_collision.gameObject.GetComponent <Rigidbody> ();

        if (t_colRigidbody == null)
        {
            return;
        }

        CS_Prop_Pickup   t_pickUp   = g_collision.gameObject.GetComponent <CS_Prop_Pickup> ();
        CS_Prop_Knockout t_knockout = g_collision.gameObject.GetComponent <CS_Prop_Knockout> ();

        if (t_pickUp != null && t_knockout != null)
        {
            //is a pick up
            if (t_pickUp.MyHolder != null &&
                t_pickUp.MyHolder != this.gameObject)
            {
                //someone hit me with the object

                Debug.Log("someone hit me with the object");

                float t_sqrImpulse = g_collision.impulse.sqrMagnitude;

                if (t_sqrImpulse * t_knockout.GetSqrImpulseScale() >
                    myPlayerSettings.myKnockedOutSqrImpulse)
                {
                    Debug.Log("KnockOut");
                    Debug.LogWarning(g_collision.gameObject.name + ": " + t_sqrImpulse * t_knockout.GetSqrImpulseScale());

                    switch (t_knockout.GetKnockoutType())
                    {
                    case KnockoutType.Drop:
                        KnockedOut_Drop(g_collision);
                        break;

                    case KnockoutType.Stun:
                        KnockedOut_Stun(g_collision);
                        break;
                    }
                }

                if (t_pickUp.OnHold == false)
                {
                    t_pickUp.MyHolder = null;
                }
            }
        }

        CS_PlayerControl t_player = g_collision.gameObject.GetComponent <CS_PlayerControl> ();

        if (t_player != null)
        {
            //is a player

            if (t_player.GetOnDash())
            {
                KnockedOut_Drop(g_collision);
            }
        }
    }
Ejemplo n.º 11
0
 void Start()
 {
     myPlayerControl = GameObject.FindGameObjectWithTag(CS_Global.NAME_PLAYER).GetComponent <CS_PlayerControl> ();
 }
Ejemplo n.º 12
0
            public override void Enter(GameObject g_player, GameObject g_goal)
            {
//				Debug.Log ("Enter!");

                CS_PlayerControl t_playerControl = g_player.GetComponent <CS_PlayerControl> ();

                if (t_playerControl == null)
                {
                    return;
                }

                int t_index = CS_PlayerManager.Instance.GetIndexNumber(t_playerControl.GetTeam());

                if (isActive [t_index] == false)
                {
                    return;
                }

                if (myFlags [t_index].ContainsKey(g_goal))
                {
                    if (myFlags [t_index] [g_goal] == false)
                    {
                        //active flag

                        //play particle
                        ParticleSystem t_particle =
                            PoppingParticlePoolManager.Instance.GetFromPool(Hang.PoppingParticlePool.ParticleType.ScoreSub);
                        t_particle.transform.position = g_goal.transform.position + new Vector3(0, 1.5f, 0);
                        ParticleActions.SetColor(t_particle, CS_PlayerManager.Instance.GetTeamColorFromIndex(t_index));
                        t_particle.Play();

                        //change flag color
                        g_goal.GetComponent <CS_Prop_Color> ().SetColor(
                            CS_PlayerManager.Instance.GetTeamColorFromIndex(t_index, true)
                            );

                        //play sound
                        AiryAudioManager.Instance.GetAudioData("ScoreSmallSounds").Play(g_goal.transform.position);

                        myFlags [t_index] [g_goal] = true;
                        Debug.Log("flag");
                    }
                }
                else if (g_goal == myGoal && CheckGoal(t_index))
                {
                    //check all touch

                    bool t_allTouched = true;
                    foreach (bool f_flagStatus in myFlags[t_index].Values)
                    {
                        if (f_flagStatus == false)
                        {
                            t_allTouched = false;
                            break;
                        }
                    }

                    if (t_allTouched)
                    {
                        //reset flags, using System.Linq;
                        foreach (GameObject key in myFlags[t_index].Keys.ToList())
                        {
                            myFlags [t_index] [key] = false;
                        }

                        //play particle
                        ParticleSystem t_particle =
                            PoppingParticlePoolManager.Instance.GetFromPool(Hang.PoppingParticlePool.ParticleType.Score);
                        t_particle.transform.position = g_player.transform.position;
                        ParticleActions.SetColor(t_particle, CS_PlayerManager.Instance.GetTeamColorFromIndex(t_index));
                        t_particle.Play();

                        //play sound
                        AiryAudioManager.Instance.GetAudioData("ScoreSounds").Play(g_goal.transform.position);

                        Debug.Log("PLAYEED");

                        Goal(t_index);
                    }
                    else
                    {
                        Debug.Log("Missing Flag");
                    }
                }
            }