Exemple #1
0
    //ToDo: If soldier is standing on platform and flag is returned, point is not scored
    //until onTriggerEnter event happens between ally flag and ally platform.
    public override void trigger(Collider other)
    {
        FlagActions flag;

        //an un-allied flag collided with this platform
        if (flagIsHome && (flag = other.gameObject.GetComponent <FlagActions> ()) != null && flag.getNetID() != netID)
        {
            //score a point
            StateManager.state.ScorePoint(netID);
            //return the opponent's flag
            flag.returnFlag();
            //set lockout window
        }
    }
Exemple #2
0
    // Start is called before the first frame update
    void Awake()
    {
        string parentName = transform.parent.gameObject.name;

        flagPos = new Vector3(this.transform.position.x, this.transform.position.y + flagPrefab.transform.position.y, this.transform.position.z);
        if (flag == null)
        {
            flag = Instantiate(flagPrefab, flagPos, flagPrefab.transform.rotation, this.transform.parent).GetComponent <FlagActions>();
        }
        flag.setHome(this.gameObject);
        flagIsHome = true;
        netID      = short.Parse(parentName.Remove(0, 3));
        platformRenderer.material.color = GuiManager.GetColorByNetID(netID);
    }
    private void DestroyThis()
    {
        actions.CancelAttack();
        state.RemoveUnit(this.gameObject);
        this.transform.parent = null;
        state.selection.CleanupSelection(this);
        FlagActions flag = null;

        if (GetComponent <SoldierActions> () != null &&
            (flag = GetComponentInChildren <FlagActions> ()) != null)
        {
            flag.getDropped();
            flag.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z);
        }

        Destroy(this.gameObject);
    }