Exemple #1
0
    /**
     * Attach a dam to this location
     *
     * @param dam The dam being placed in the level
     */
    public void AttachDam(Dam dam)
    {
        if (!inUse)
        {
            // Position the dam within hierarchy and game space to match the dam location
            Transform transform1;
            (transform1 = dam.transform).SetParent(transform.parent);
            var transform2 = transform;
            transform1.position   = transform2.position;
            transform1.rotation   = transform2.rotation;
            transform1.localScale = transform2.localScale;

            dam.Activate(dropOffBox);

            // The location is now in use and cannot be used by any other dam
            inUse = true;

            // Keep track of the dam for use later
            currentDam = dam;

            //print("Turn attached");

            //placementTurn = GameManager.Instance.Turn;
        }
        else
        {
            Debug.Log("Trying to attach dam to in-use location -- this line should not be reached!");
        }
    }
    /**
     * Attach a dam to this location
     */
    public void AttachDam(Dam dam)
    {
        if (!inUse)
        {
            // position the dam within hierarchy and game space to match the dam location
            dam.transform.SetParent(transform.parent);
            dam.transform.position   = transform.position;
            dam.transform.rotation   = transform.rotation;
            dam.transform.localScale = transform.localScale;

            dam.Activate(dropOffBox);

            // the location is now in use and cannot be used by any other dam
            inUse = true;

            // keep track of the dam for use later
            currentDam = dam;
        }
        else
        {
            Debug.Log("Trying to attach dam to in-use location -- this line should not be reached!");
        }
    }