コード例 #1
0
ファイル: UFO.cs プロジェクト: prim4t/rocketeers
    /************* Called externally ***********************/

    // called before the UFO really does anything. Lets the UFO know who the target is
    public void SetPlayer(Player player)
    {
        player_to_respawn                  = player;
        state                              = UFOForm.FlyingTowards;
        players_original_parent            = player.transform.parent;
        players_original_layer             = player.gameObject.layer;
        player_to_respawn.gameObject.layer = LayerMask.NameToLayer("TransparentFX");
    }
コード例 #2
0
ファイル: UFO.cs プロジェクト: prim4t/rocketeers
 // when the UFO is flying towards a player that has fallen off the ship
 void FlyingTowardsUpdate()
 {
     transform.position = Vector3.Lerp(transform.position,
                                       player_to_respawn.transform.position,
                                       Time.deltaTime * 0.8f);
     if (Vector3.Distance(transform.position, player_to_respawn.transform.position) <= GRABBING_THRESHOLD)
     {
         state = UFOForm.Towing;
         transform.position = player_to_respawn.transform.position;
         player_to_respawn.transform.SetParent(transform);
         player_to_respawn.transform.localPosition = HELD_POS;
     }
 }
コード例 #3
0
ファイル: UFO.cs プロジェクト: prim4t/rocketeers
    // when the UFO is towing a player back to the core of the ship
    void TowingUpdate()
    {
        transform.position = Vector3.Lerp(transform.position,
                                          Utils.GetCorePosition(player_to_respawn.teamNum),
                                          Time.deltaTime * 1.5f);

        if (Vector3.Distance(transform.position, Utils.GetCorePosition(player_to_respawn.teamNum)) <= DROPPING_THRESHOLD)
        {
            player_to_respawn.transform.SetParent(players_original_parent);
            player_to_respawn.gameObject.layer = players_original_layer;
            player_to_respawn.GetComponent <Rigidbody2D>().gravityScale = 2f;
            player_to_respawn.form = PlayerForm.Normal;
            state = UFOForm.FlyingAway;
        }
    }